wasm-encoder: add ComponentBuilder::instantiate_exports - #2655
alexcrichton merged 1 commit into
Conversation
f66f04b to
5c4e5a8
Compare
|
Thanks for the PR, and looks like a rustfmt is needed to get CI passing. Also please make sure to review our AI tool usage policy, for a change like this a small new function doesn't need such a large PR description |
|
Sorry about that. Damn things are a little too enthusiastic to post a PR before I can review it. I really wish they'd add something that would queue so it couldn't send them out before review. "Let me just go ahead and submit that PR.....beep bop-boop!" nooooo!!! :) |
FYI, just to make the point more explicit: automated posting of code that has not been reviewed by a human is even more against our policies than the lengthy LLM-generated description is. (In this case it's a trivial function, but the process is important here.) I say this because your wording seems to imply somehow that this is not in your control ("I wish they'd add..."). I'd recommend either removing your bot's GitHub token or setting a hard blocker on creating PRs to Bytecode Alliance repos in whatever permissions system you have until you can work out why this slipped through. If we otherwise have an account that is posting AI-authored content, unreviewed by humans, with a human admitting they don't have full control of it, then this would have to go to the TSC for further action. Thanks! |
|
I appreciate that. I was just highlighting that it's far too easy to have happen and making a joke out of it |
|
On that note I think WebAssembly should be used more often for AI agent sanboxing. It could possibly have prevented the recent OpenAI/HF incident. |
The core-level analogue `core_instantiate_exports` already exists on `ComponentBuilder` and mirrors the `Instance::FromExports` variant of the core instance section. The component-level side had no equivalent: `ComponentInstanceSection::export_items` is public but only reachable through the manual section-append path, not the builder facade. Add `instantiate_exports` next to `instantiate` so callers rebuilding a component structurally from a parsed one can round-trip `ComponentInstance::FromExports` the same way core-level `Instance::FromExports` already round-trips. The signature follows the section-level `ComponentInstanceSection:: export_items` — `N: Into<ComponentExternName<'a>>` in the name slot, preserving the rich name form (`implements` / `version_suffix` / `external_id`) an item can carry. `&'a str` satisfies the bound via the existing `From<&'a str> for ComponentExternName<'a>`, so callers that only need a plain name write the same call as with `core_instantiate_exports`.
0c84bd8 to
6881e52
Compare
|
Updated as requested. |
Adds
ComponentBuilder::instantiate_exportsas the component-level counterpart to the existingcore_instantiate_exports, so callers can round-tripComponentInstance::FromExportsthrough the builder without dropping down to the raw section API.